package com.xj.pattern.strategy.impl;

public class CglibSubclassingInstantiationStrategy extends SimpleInstantiationStrategy {

	@Override
	public Object instantiate(String bean) {
		//对bean进行实例化
		return new CglibSubclassCreator().instantiate(bean);
	}

	
	private static class CglibSubclassCreator {
		public Object instantiate(String bean) {
			//对bean进行实例化
			Object o = null;
			try{
				System.out.println("使用CglibSubclassingInstantiationStrategy来实现实例化:"+bean);
				o = Class.forName(bean);
			}catch (Exception e) {
			}
			return o; 
		}
	}
	
}
